#ifndef __hw_timebase_10k_h
#define __hw_timebase_10k_h

#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "user.h"

typedef enum
{
    COUNTERMODE_NO_CYCLE=0,
    COUNTERMODE_INFINITE_CYCLES,
    COUNTERMODE_FINITE_CYCLES,
}CounterMode_E;

typedef enum
{
    CYCLE_STOP=0,
    CYCLE_END,
    CYCLE_RUNNING,
    CYCLE_READY,
}CounterState_E;

typedef struct
{
    uint8_t counterFlag;
    uint32_t countIndex;
    uint32_t startTime1;
    uint32_t startTime2;
    uint32_t stopTime1;
    uint32_t stopTime2;
    CounterState_E state;
}timeBaseCounter_T;

__interrupt void cpuTimer0ISR(void);
void initCPUTimers(void);
void timebase_cupTim0Init(void);
void configCPUTimer(uint32_t cpuTimer, float freq, float period);
uint32_t getTimeBaseCount1(void);
timeBaseCounter_T USER_cpuSoftTimerInit(void);
void USER_cpuSoftTimerClearFlag(timeBaseCounter_T *counterNum);
void USER_cpuSoftTimerSetTimeOut(timeBaseCounter_T *counterNum,uint32_t timeout);
uint32_t USER_cpuSoftTimerGetRunTime(timeBaseCounter_T *counterNum);
uint8_t USER_cpuSoftTimerDelay(timeBaseCounter_T *counterNum,uint32_t timeout);

#endif // !__hw_timebase_10k_h
